OpenCSVCursor Function

Opens a comma-delimited text file as a RecordSet. The file must use commas to separate fields, returns to separate records, and double quotes ("") to enclose text fields.

Syntax

result = OpenCSVCursor( file )


Parameters

file

FolderItem

FolderItem that refers to the text file.


Commas are permitted within quoted strings. The following record is valid:

22,"Fred","Duesenberg","Engineer"

Note

OpenCSVCursor requires the CSV Database plug-in. Place this plug-in in the REALbasic Plugins folder. The REALbasic CD includes all database plug-ins and you can always find the most current versions on REAL Software's web site, www.realsoftware.com.


Example

The following example opens the specified text file.

Dim db as RecordSet
db=OpenCSVCursor(GetFolderItem("table1.txt"))
If db = Nil then
  Beep
  MsgBox "The database couldn't be opened."
else
  //continue with database operations
end if

See Also

Database, DatabaseField, RecordSet classes; OpenDBFCursor, OpenDTFDatabase functions.